<?php
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
function getlang(){
		$lang = $_SESSION['lang'];
		if (empty($lang) || $lang == "EN") {
			$value = "../value/value_en.php";
		} else if($lang == "VN") {
			$value = "../value/value_vn.php";
		}
		else {
			$value = "../value/value_kr.php";
		}
		return $value;
	}
$value = getlang();
include($value);
$listpayment =$_SESSION['listpayment'];

#echo $_GET['action'];
if (isset($_GET['action'])){
	if($_GET['action']=='add'){

		$listpayment[]=array("","",0,"");
		
	}


	
	if($_GET['action']=='chCurency'){
		$id=$_GET['id'];
		for($i=0;$i<count($listpayment);$i++){
			if ($i==($id-1)){
				$listpayment[$i][2]=$_GET['value'];
			}
		}
	}
	if($_GET['action']=='chRemarks'){
		$id=$_GET['id'];

		for($i=0;$i<count($listpayment);$i++){
			if ($i==($id-1)){
				$listpayment[$i][3]=$_GET['value'];
			}
		}
	}
	if($_GET['action']=='chItem'){
		$id=$_GET['id'];
		for($i=0;$i<count($listpayment);$i++){
			if ($i==($id-1)){
				$listpayment[$i][0]=$_GET['value'];
			}
		}
	}
	if($_GET['action']=='chContent'){
		$id=$_GET['id'];
		for($i=0;$i<count($listpayment);$i++){
			if ($i==($id-1)){
				$listpayment[$i][1]=$_GET['value'];
			}
		}
	}
}
$i=1;
$total=0;
foreach ($listpayment as $payment){
	$total=$total+$payment[2];
}
echo number_format($total);
?>

		
<?php $_SESSION['listpayment']=$listpayment;?>
